package com.eqgis.eqtool.animation;

import android.view.View;

import java.util.Timer;
import java.util.TimerTask;

/**
 * 点击动画
 */
public class ClickAnimation {
    private float scale = 1.0f;
    private float maxValue = 1.5f;
    private float minValue = 1.5f;
    private View view;
    private Timer timer;

    public ClickAnimation(View view) {
        this.view = view;
    }

    /**
     * 放大后恢复
     */
    public void undoAfterExpand(){
        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                scale += 0.1f;
                view.setScaleX(scale);
                view.setScaleY(scale);
                if (scale > 1.5f){
                    scale = 1.0f;
                    view.setScaleX(scale);
                    view.setScaleY(scale);
                    timer.cancel();
                }
            }
        },0,25);
    }
}
